<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:79:"/data/www/html/web2017/public_html/../application/web/view/user/instit_reg.html";i:1495540838;s:78:"/data/www/html/web2017/public_html/../application/web/view/public/header2.html";i:1496220126;}*/ ?>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="hzcmgd">
    <title>树人学习</title>
    <link rel="icon" href="favicon.ico">

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="http://v3.bootcss.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="/static/pc/reg.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="http://v3.bootcss.com/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="http://v3.bootcss.com/assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/admin/js/jquery.form.js"></script>
    <script src="/static/admin/js/plugins/layer/laydate/laydate.js"></script>
    <script src="/static/pc/js/layer/layer.js"></script>
    <script src="/static/admin/js/laypage/laypage.js"></script>
    <script src="/static/admin/js/laytpl/laytpl.js"></script>
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">

    <style>
        .webuploader-pick {
            position: relative;
            display: inline-block;
            cursor: pointer;
            background: #00b7ee;
            padding: 0px 3px ;
            color: #fff;
            text-align: center;
            border-radius: 3px;
            overflow: hidden;
            height: 37px;
        }
    </style>

</head>

<body>
<!--<nav class="navbar navbar-fixed-top navbar-inverse">-->
    <!--<div class="navbar-header">-->
        <!--<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">-->
            <!--<span class="sr-only">Toggle navigation</span>-->
            <!--<span class="icon-bar"></span>-->
            <!--<span class="icon-bar"></span>-->
            <!--<span class="icon-bar"></span>-->
        <!--</button>-->
        <!--<a class="navbar-brand" href="#">树人100</a>-->
    <!--</div>-->
    <!--<div id="navbar" class="collapse navbar-collapse">-->

        <!--<div class="nav navbar-nav navbar-right">-->
            <!--&lt;!&ndash;<form class="navbar-form navbar-left">&ndash;&gt;-->
                <!--&lt;!&ndash;<div class="form-group">&ndash;&gt;-->
                    <!--&lt;!&ndash;<input type="text" class="form-control" placeholder="搜索内容">&ndash;&gt;-->
                <!--&lt;!&ndash;</div>&ndash;&gt;-->
                <!--&lt;!&ndash;<button type="submit" class="btn btn-default">确定</button>&ndash;&gt;-->
            <!--&lt;!&ndash;</form>&ndash;&gt;-->

        <!--</div>-->
    <!--</div>&lt;!&ndash; /.nav-collapse &ndash;&gt;-->

    <!--</div>&lt;!&ndash; /.container &ndash;&gt;-->
<!--</nav>&lt;!&ndash; /.navbar &ndash;&gt;-->
<nav class="navbar navbar-fixed-top navbar-inverse">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
            <a  href="#"><img src="/static/pc/image/logo.png" style="height: 50px;padding-right: 20px;"></a>
        </div>
        <div id="navbar" class="collapse navbar-collapse" style="font-size:16px;">
            <ul class="nav navbar-nav">
                <li><a href="<?php echo url('index/index'); ?>">首页</a></li>
                <li><a href="<?php echo url('user/center'); ?>">个人主页</a></li>
                <!--<li><a href="#contact">Contact</a></li>-->
            </ul>
            <div class="nav navbar-nav navbar-right">
                <!--<form class="navbar-form navbar-left">-->
                <!--<div class="form-group">-->
                <!--<input type="text" class="form-control" placeholder="搜索内容">-->
                <!--</div>-->
                <!--<button type="submit" class="btn btn-default">确定</button>-->
                <!--</form>-->
                <ul class="nav navbar-nav navbar-right">
                    <li class="active"><a href="<?php echo url('article/user_index'); ?>">用户中心</a></li>
                    <?php if($is_login==1): ?>
                    <li><a href="<?php echo url('user/quitlogin'); ?>">退出</a></li> <?php endif; ?>
                    <!--<li class="dropdown">-->
                    <!--<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">方法 <span class="caret"></span></a>-->
                    <!--<ul class="dropdown-menu">-->
                    <!--<li><a href="#">订单</a></li>-->
                    <!--<li><a href="#">嗯嗯</a></li>-->
                    <!--<li><a href="#">尺寸</a></li>-->
                    <!--<li role="separator" class="divider"></li>-->
                    <!--<li><a href="#">嗷嗷</a></li>-->
                    <!--</ul>-->
                    <!--</li>-->
                </ul>
            </div>
        </div>
        <!-- /.nav-collapse -->
    </div>
    <!-- /.container -->
</nav>
<!-- /.navbar -->

<div class="container container-form"  style="width: 1000px; padding: 0 185px;">

    <div class="page-header">
        <h2>机构申请入驻</h2>
    </div>

    <form class="form-horizontal m-t" name="add" id="add" method="post" action="<?php echo url('user/instit_reg'); ?>">


        <div class="form-group">
            <label for="username" class="col-sm-2 control-label" >机构名称:</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="name" id="name" value=""  placeholder="请输入机构名称">
            </div>
        </div>





        <div class="form-group">
            <label for="name" class="col-sm-2 control-label" >负责人姓名:</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="username" id="username" value="" placeholder="请输入负责人姓名">
            </div>
        </div>


        <div class="form-group">
            <label for="name" class="col-sm-2 control-label" >手机号码:</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="mobile" id="mobile" placeholder="请输入手机号码" />
            </div>
        </div>




        <div class="form-group">
            <label class="col-sm-2 control-label">营业执照:</label>
            <div class="col-sm-10">
                <input type="hidden" id="data_photo" name="photo" value="">
                <div id="fileList" class="uploader-list" style="float:right"></div>
                <div id="imgPicker" style="float:left">选择图片</div>
                <img id="img_data" height="100px" style="float:left;margin-left: 50px;margin-top: -10px;" src="/uploads/images/"  onerror="this.src='/static/admin/images/no_img.jpg'"     />
            </div>
        </div>


        <div class="form-group" style="margin-top: 20px;">
                <label class="col-sm-2 control-label">负责人手持身份证:</label>
                <div class="col-sm-10">
                <input type="hidden" id="data_photo1" name="photo1" value="">
                <div id="fileList1" class="uploader-list" style="float:right"></div>
                <div id="imgPicker1" style="float:left">选择图片</div>
                <img id="img_data1" height="100px" style="float:left;margin-left: 50px;margin-top: -10px;" src="/uploads/images/"  onerror="this.src='/static/admin/images/no_img.jpg'"     />
            </div>
        </div>




        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交</button>&nbsp;&nbsp;&nbsp;</div>
        </div>
    </form>


</div><!--/.container-->

<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>

<script type="text/javascript">
    var $list = $('#fileList');
    //上传图片,初始化WebUploader
    var uploader = WebUploader.create({

        auto: true,// 选完文件后，是否自动上传。
        swf: '/static/admin/js/webupload/Uploader.swf',// swf文件路径
        server: "<?php echo url('Web/Upload/upload'); ?>",// 文件接收服务端。
        duplicate :true,// 重复上传图片，true为可重复false为不可重复
        pick: '#imgPicker',// 选择文件的按钮。可选。

        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/jpg,image/jpeg,image/png'
        },

        'onUploadSuccess': function(file, data, response) {
            $("#data_photo").val(data._raw);
            $("#img_data").attr('src', '/uploads/images/' + data._raw).show();
        }
    });

    uploader.on( 'fileQueued', function( file ) {
        $list.html( '<div id="' + file.id + '" class="item">' +
                '<h4 class="info">' + file.name + '</h4>' +
                '<p class="state">正在上传...</p>' +
                '</div>' );
    });

    // 文件上传成功
    uploader.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    });



    var $list1 = $('#fileList1');
    //上传图片,初始化WebUploader
    var uploader1 = WebUploader.create({

        auto: true,// 选完文件后，是否自动上传。
        swf: '/static/admin/js/webupload/Uploader.swf',// swf文件路径
        server: "<?php echo url('Web/Upload/upload'); ?>",// 文件接收服务端。
        duplicate :true,// 重复上传图片，true为可重复false为不可重复
        pick: '#imgPicker1',// 选择文件的按钮。可选。

        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/jpg,image/jpeg,image/png'
        },

        'onUploadSuccess': function(file, data, response) {
            $("#data_photo1").val(data._raw);
            $("#img_data1").attr('src', '/uploads/images/' + data._raw).show();
        }
    });

    uploader1.on( 'fileQueued', function( file ) {
        $list1.html( '<div id="' + file.id + '" class="item">' +
                '<h4 class="info">' + file.name + '</h4>' +
                '<p class="state">正在上传...</p>' +
                '</div>' );
    });

    // 文件上传成功
    uploader1.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader1.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    });






    $(function(){
        $('#add').ajaxForm({
            beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: complete, // 这是提交后的方法
            dataType: 'json'
        });

        function checkForm(){



                if( '' == $.trim($('#name').val())){
                    layer.msg('机构名称不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                    });
                    return false;
                }

                if( '' == $.trim($('#username').val())){
                    layer.msg('姓名不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                    });
                    return false;
                }

                if( '' == $.trim($('#mobile').val())){
                    layer.msg('电话不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                    });
                    return false;
                }

                if( '' == $.trim($('#data_photo').val())){
                    layer.msg('请上传营业执照', {icon: 5,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                    });
                    return false;
                }

            if( '' == $.trim($('#data_photo1').val())){
                layer.msg('请上传负责人手持身份证照片', {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }







        }

        function complete(data){
            if(data.code == 1){
                layer.msg('申请成功', {icon: 6,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                        window.location.href="<?php echo url('index/index'); ?>";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
        }

    });



</script>

</body>
</html>
